package com.zhanbo.zhanbowymusic.main;

import android.os.Bundle;

import androidx.annotation.Nullable;

import com.mwx.baselib.base.BaseFragment;
import com.zhanbo.zhanbowymusic.R;
import com.zhanbo.zhanbowymusic.databinding.FragmentContentBinding;
import com.zhanbo.zhanbowymusic.main.bean.CreatePlaylistDetailsEBBean;
import com.zhanbo.zhanbowymusic.main.bean.SettingEBBean;
import com.zhanbo.zhanbowymusic.main.mine.create.CreatePlaylistDetailsFragment;
import com.zhanbo.zhanbowymusic.main.featured.FeaturedFragment;
import com.zhanbo.zhanbowymusic.main.mine.collections.CollectionsFragment;
import com.zhanbo.zhanbowymusic.main.mine.create.CreatePlayListFragment;
import com.zhanbo.zhanbowymusic.main.mine.like.LikeFragment;
import com.zhanbo.zhanbowymusic.main.mine.recently.RecentlyPlayedFragment;
import com.zhanbo.zhanbowymusic.main.podcast.PodcastFragment;

import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode;

import me.yokeyword.fragmentation.ISupportFragment;

/**
 * 内容页fragment
 */
public class ContentFragment extends BaseFragment<FragmentContentBinding> {


    private ISupportFragment[] mFragments;


    @Override
    protected void init(Bundle savedInstanceState) {
        mFragments = new ISupportFragment[6];
        mFragments[0] = FeaturedFragment.newInstance();
//        mFragments[1] = PodcastFragment.newInstance();
        mFragments[1] = PrivateRoamingFragment.newInstance();
        mFragments[2] = LikeFragment.newInstance();
        mFragments[3] = RecentlyPlayedFragment.newInstance();
        mFragments[4] = CollectionsFragment.newInstance();
        mFragments[5] = CreatePlayListFragment.newInstance();
        loadMultipleRootFragment(R.id.fl_content, 0,
                mFragments[0],
                mFragments[1],
                mFragments[2],
                mFragments[3],
                mFragments[4],
                mFragments[5]);
    }

    @Override
    public void onLazyInitView(@Nullable Bundle savedInstanceState) {
            super.onLazyInitView(savedInstanceState);

    }


    @Override
    protected Object getLayout() {
        return R.layout.fragment_content;
    }

    @Override
    protected void initData() {

    }

    @Override
    protected void initView() {

    }

    @Override
    protected void initListener() {

    }

    public void setPage(int page){
        showHideFragment(mFragments[page]);
    }
    public static ContentFragment newInstance() {

        Bundle args = new Bundle();

        ContentFragment fragment = new ContentFragment();
        fragment.setArguments(args);
        return fragment;
    }
    @Override
    public void onDestroy() {
        super.onDestroy();
        EventBus.getDefault().unregister(this);
    }
}